feature
A good way to segregate dev environments is to spin up a virtual machine (VM) for each project, and install your stack there. When you need to work on the project, simply spin up the VM – no need to upgrade code, your environment will remain the same as how you left it. There are two options available for installing docker on windows.
  • Docker for windows
  • Docker Toolbox

Installation

To get started, head over to the Docker documentation pages for instructions on how to install Docker on your OS. The instructions differ depending on your OS:

  • If you are rocking Linux already, in any flavour, you can install Docker ‘natively’.
  • If you are running OS X or Windows, you can’t install Docker directly, since it requires a Linux host to create containers. Luckily the Boot2Docker project was built to specifically fill this void.

    How to use Docker file

    Using the Dockerfiles is as simple as having the docker daemon run one. The output after executing the script will be the ID of the new docker image.

Usage:
Build an image using the Dockerfile at current location

Example: sudo docker build -t [name] . sudo docker build -t my_mongodb .

Creating the Empty Dockerfile

Using the nano text editor, let’s start editing our Dockerfile.

sudo nano Dockerfile

Setting The Base Image to Use

Set the base image to Ubuntu

FROM ubuntu

Defining The Maintainer (Author)

File Author / Maintainer
MAINTAINER Example McAuthor

Docker Commands

Build Image:
docker build -t myprojectimage .
Run Image or create container:
docker run -it -v C:\Users\Clofus1\Documents\myprojects:/srv/myprojectsfolder -dp 80:80 -p 27017:27017 --name myprojectcontainer myprojectimage
Enter Container bash terminal:
docker exec -it <cid> bash
To stop container:
docker stop <cid>
To remove container:
docker rm <cid>
To remove image:
docker rmi <image id>
To list running container:
docker ps
To list recently runned container:
docker ps -a

For any query contact Clofus Innovations.

Contact Us

Just leave your email and our support team will help you